package com.zmn.plat.services.impl.standard.read;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.zmn.plat.model.entity.standard.read.StandardRead;
import com.zmn.plat.model.entity.standard.read.StandardReadQuery;
import com.zmn.plat.persistence.interfaces.standard.read.StandardReadDao;
import com.zmn.plat.services.interfaces.standard.read.StandardReadService;

@Service
public class StandardReadServiceImpl implements StandardReadService {

    @Resource
    StandardReadDao standardReadDao;

    @Override
    public StandardRead findByKey(Integer id) {
        return standardReadDao.findByKey(id);
    }

    @Override
    public List<StandardRead> listPageByQuery(StandardReadQuery query) {
        int count = countByQuery(query);
        query.setTotalCount(count);
        return standardReadDao.listPageByQuery(query);
    }

    @Override
    public List<StandardRead> listByQuery(StandardReadQuery query) {
        return standardReadDao.listByQuery(query);
    }

    @Override
    public List<StandardRead> listAll() {
        return standardReadDao.listAll();
    }

    @Override
    public Integer countByQuery(StandardReadQuery query) {
        return standardReadDao.countByQuery(query);
    }

    @Override
    public Integer updateByKey(StandardRead standardRead) {
        return standardReadDao.updateByKey(standardRead);
    }

    @Override
    public Integer insert(StandardRead standardRead) {
        return standardReadDao.insert(standardRead);
    }

    @Override
    public Integer insertBatch(List<StandardRead> standardReads) {
        return standardReadDao.insertBatch(standardReads);
    }

    @Override
    public Integer deleteByKey(Integer id) {
        return standardReadDao.deleteByKey(id);
    }

    @Override
    public Integer deleteByStandardId(Integer standardId) {
        return standardReadDao.deleteByStandardId(standardId);
    }
}